﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcCaja.Core;
using Chilis.Caja.Data.Models;
using System.Web.Routing;

namespace MvcCaja.Controllers
{
    public class ConsumoController : Controller
    {
        //
        // GET: /Consumo/

        public ActionResult Index()
        {
            MesaService oMesaService = new MesaService();

            ViewBag.Mesas = oMesaService.obtener();
            return View();
        }

        public ActionResult Cobros(string CodigoOrden)
        {
            OrdenService oOrdenService = new OrdenService();

            Orden oOrden = oOrdenService.obtenerOrden(CodigoOrden);

            return View(oOrden);
        }

        public ActionResult AnularPago(string CodigoOrden, int NumeroCuenta)
        {
            PagoService oPagoService = new PagoService();

            oPagoService.eliminar(CodigoOrden, NumeroCuenta);

             return RedirectToAction("Cobros", new RouteValueDictionary(
                new { controller = "Consumo", action = "Cobros", CodigoOrden = CodigoOrden }));
        }
    }
}